using System.Collections;
using Script;
using UnityEngine;

public class EndlessDungeonController : MonoBehaviour
{
    private PlayerStates _playerStatesNow; // 当前玩家属性（局内成长）
    private PlayerStates _playerStatesMax; // 最大/基础玩家属性（局外成长）

    /// <summary>
    /// Unity生命周期方法，启动地牢冒险主流程
    /// </summary>
    private void Start()
    {
        StartCoroutine(MyGame());
    }

    /// <summary>
    /// 地牢冒险主流程协程，负责整体游戏流程控制
    /// </summary>
    private IEnumerator MyGame()
    {
        // 1. 发牌
        yield return StartCoroutine(FightMainUI.Instance.PushMiGongCard());

        // 2. 初始化属性
        //_playerStatesMax = LoadPlayerMetaData(); // 读取局外成长
        _playerStatesNow = new PlayerStates(_playerStatesMax.BaseHp, _playerStatesMax.BaseMp);
        _playerStatesNow.ResetToBase();

        // 3. 显示属性
        PlayerStatesUI.Instance.ShowPlayerStates(_playerStatesNow, _playerStatesMax);

        // 4. 地牢流程
        // while (!IsGameOver())
        // {
        //     // 进入房间、触发事件、战斗等
        //     yield return StartCoroutine(RoomEvent());
        // }

        // 5. 结算
        //yield return StartCoroutine(GameResult());
    }

    /// <summary>
    /// 读取玩家局外成长数据（如装备、等级等），返回最大属性
    /// </summary>
    private PlayerStates LoadPlayerMetaData()
    {
        return null;
        //throw new System.NotImplementedException();
    }

    /// <summary>
    /// 判断冒险是否结束（如玩家死亡、通关等）
    /// </summary>
    private bool IsGameOver()
    {
        throw new System.NotImplementedException();
    }

    /// <summary>
    /// 处理每个房间的事件（如战斗、宝箱、商店等）
    /// </summary>
    private IEnumerator RoomEvent()
    {
        throw new System.NotImplementedException();
    }

    /// <summary>
    /// 冒险结算流程（如奖励、结算界面等）
    /// </summary>
    private IEnumerator GameResult()
    {
        throw new System.NotImplementedException();
    }
}
